#include <stdio.h>
#include <stdlib.h>

#define MAX_SIZE 8

int ans;
int map[MAX_SIZE][MAX_SIZE];

int check (int x, int y)
{
    int i;

    for (i = 0; i < x; i++) {
        if (map[i][y] == 2) {
            return 0;
        }
    }
    
    return 1;
}

int dfs (int n, int k, int num, int start)
{
    int i, j;

    if (num == k) {
        ++ans;
        return 0;
    }

    for (i = start; i < n; i++) {
        for (j = 0; j < n; j++) {
            if (map[i][j] && check(i, j)) {
                map[i][j] = 2;
                dfs(n, k, num+1, i+1);
                map[i][j] = 1;
            }
        }
    }

    return 0;
}

int main (int argc, char const* argv[])
{
    int n, k, i, j;
    char ch;

    while (scanf("%d %d", &n, &k) && n != -1) {
        getchar(); // get /n
        for (i = 0; i < n; i++) {
            for (j = 0; j < n; j++) {
                ch = getchar();
                if (ch == '#') {
                    map[i][j] = 1;
                } else {
                    map[i][j] = 0;
                }
            }
            getchar();
        }

        ans = 0;
        dfs(n, k, 0, 0);

        printf("%d\n", ans);
    }

    return 0;
}
